﻿CREATE PROCEDURE [dbo].[Text_User_Update]
	@userId UNIQUEIDENTIFIER,
	@expired DATETIME
AS
BEGIN
	IF NOT EXISTS (SELECT * FROM [dbo].[user_User] WHERE [UserId] = @userId)
		RETURN

	BEGIN TRAN
		IF EXISTS (SELECT * FROM [dbo].[text_User] WHERE [UserId] = @userId)
			DELETE FROM [dbo].[text_User] WHERE [UserId] = @userId

		INSERT INTO [dbo].[text_User]
								([UserId]
								,[Expired])
					VALUES
								(@userId
								,@expired)
	COMMIT TRAN

END